﻿@model PagedList<Orange.Mvc4App.Models.Module>
@{
    int? belongTo = (int?)ViewBag.Id;
}
<p class="message">
    @if (@ViewBag.Msg != null) {
        <img src="../../Content/images/icon-info.gif" alt="提示" />@ViewBag.Msg
    }
</p>
@if (Model != null && Model.PageCount > 0) {
    <table class="list">
        <tr>
            <th style="width: 80px;">
                编号
            </th>
            <th>
                模块名称
            </th>
            <th>
                URL
            </th>
            <th>
                操作
            </th>
        </tr>
        @foreach (var item in Model) {
            <tr>
                <td>
                    @Html.DisplayFor(m => item.Id)
                </td>
                <td>
                    @*@Html.ActionLink(@item.Title, "Index", new { id = @item.Id })*@
                    @Html.DisplayFor(m => item.Title)
                </td>
                <td>
                    @item.Controller/@item.Action
                </td>
                <td>
                    @Html.ImageLink(Url.Action("Edit", new { id = item.Id }), Url.Content("~/Content/images/icon-edit.gif"), null)
                    @Ajax.ImageLink(null, new AjaxOptions {
                   Confirm = "确认删除吗?",
                   HttpMethod = "Post",
                   InsertionMode = InsertionMode.Replace,
                   UpdateTargetId = "list"
               }, Url.Action("Delete", new { id = item.Id, pageIndex = Model.PageIndex }), Url.Content("~/Content/images/icon_del.gif"))
                </td>
            </tr>
        }
    </table>
    <nav class="center">
        @Html.PageLinks(Model.PageCount, Model.PageIndex, i => Url.Action("Index", new { id = belongTo, pageIndex = i }))
    </nav>
} else {
    @:没有子模块了
    }